/**
 *
 * Created by Song,YeWen, 9/15/2011 1:29:12 PM
 *
 */

function  validateVideoUrl(ori_url) 
{
    //We use a fake constant duration for m1905.com, because it is Trailer, not long duration video
    //TODO: FIXME, parse: "Runtime: <strong>6m 28s</strong><br />"
    var fcduration = '100';
    var html = download_page(ori_url);
    var flv_string = copyBetween(html, 'file=', '&');	
	//var matches = html.match(/<title>(.*?)<\/title>/);
	var matches = html.match(/<title>([\s\S]*?)<\/title>/);
	if(matches){
	  return 'success_title:' + encodeURIComponent(matches[1])
	         + '\n video_urls:' + encodeURIComponent(flv_string)
	         + '\n seconds:' + Math.round(parseInt(fcduration));
	}
    return 'error:empty_path';
}

/* http://www.tubeislam.com/video/10154/Support-GuideUS-TV-Promo-2 */
function js_get_media_url(ori_url) 
{
    var html = download_page(ori_url);
    var flv_string = copyBetween(html, 'file=', '&');

	return flv_string;
}
